


layui.use(['form','layer','laydate'],function (){

    var form = layui.form;
    var layer = layui.layer;
    var laydate = layui.laydate;


    laydate.render({
        elem: '#userbirth'
    });


    $.ajax({
        type: 'get',
        url: '/home/getUser',
        success: function (res) {
            var data = res.data;

            //获得Session中的当前登陆用户的所有信息
            // console.log(sessionStorage.getItem("userA"))


            //1021新增打印
            // console.log(localStorage.getItem("userremark"));
            // console.log(localStorage.getItem("useremail"));
            // console.log(localStorage.getItem("userdatebirth"));
            //
            //
            // console.log(localStorage.getItem("userPhone"))
            // console.log(localStorage.getItem("uname"));
            $("input[name='userPhone']").val(localStorage.getItem("userPhone"));
            $("input[name='userName']").val(localStorage.getItem("uname"));


        }

    })


    form.on('submit(submit)',function (data){
        let userPwd = $('input[name="userPwd"]').val();
        let userPwned = $('input[name="userPwned"]').val();
        let userPawned = $('input[name="userPawned"]').val();


        var aaa =  localStorage.getItem("uid");
        var bbb = localStorage.getItem("userpwd")

        $.ajax({
            type: 'get',
            url: '/home/updatePwd',
            data:{userPwd:userPwd,userPwned:userPwned,userPawned:userPawned,id:aaa,userpassword:bbb},
            success:function (res){
                // console.log(res);
                layer.msg(res.msg,{time:2000});
                // console.log(res.msg)
                // console.log(aaa);
                // console.log(bbb);
                // console.log(userPwned);

                window.setTimeout(function () {
                    window.location.reload();
                },2000)
            }
        })
    })
})









